package com.cn.wanxi.controller;

import com.cn.wanxi.entity.NewsTypeEntity;
import com.cn.wanxi.entity.ResultEntity;
import com.cn.wanxi.service.INewsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/back/newsType")
public class NewsTypeController {
    @Autowired
    private INewsTypeService newsTypeService;

    @RequestMapping("/add")
    protected ResultEntity add(NewsTypeEntity newsTypeEntity){
        return newsTypeService.add(newsTypeEntity);
    }

    @RequestMapping("/del")
    protected ResultEntity delete(NewsTypeEntity newsTypeEntity){
        return newsTypeService.delete(newsTypeEntity);
    }

    @RequestMapping("/get")
    protected ResultEntity findAll(NewsTypeEntity newsTypeEntity){
        return ResultEntity.success(newsTypeService.findAll(newsTypeEntity));
    }

    @RequestMapping("/id")
    protected ResultEntity findById(NewsTypeEntity newsTypeEntity){
        return newsTypeService.findById(newsTypeEntity);
    }

    @RequestMapping("/post")
    protected ResultEntity update(NewsTypeEntity newsTypeEntity){
        return newsTypeService.update(newsTypeEntity);
    }
}
